<%--
  Created by IntelliJ IDEA.
  User: Jing
  Date: 2024/11/13
  Time: 17:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri ="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>导出请假单</title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <script src="js/jquery-3.4.1.min.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>
    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/css2.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/messageBox.css" rel="stylesheet">

    <script>
        window.onload = function() {
            var errorMessage = "${errorMessage}";
            var successMessage = "${successMessage}";
            var messageBox = document.getElementById('messageBox');

            if (errorMessage) {
                messageBox.textContent = errorMessage;
                messageBox.style.display = 'block';
                setTimeout(function() {
                    messageBox.style.display = 'none';
                }, 2000);
            } else if (successMessage) {
                messageBox.textContent = successMessage;
                messageBox.style.display = 'block';
                setTimeout(function() {
                    messageBox.style.display = 'none';
                }, 2000);
            }
        };
    </script>
</head>
<body>
<div class="container-fluid position-relative bg-white d-flex p-0">

    <div class="sidebar pe-4 pb-3">
        <nav class="navbar bg-light navbar-light">
            <a href="leave?action=listAudit" class="navbar-brand mx-4 mb-3">
                <h3 class="text-primary">网上请假系统</h3>
            </a>
            <div class="navbar-nav w-100">
                <a href="classes?action=list" class="nav-item nav-link">班级信息管理</a>
                <a href="course?action=list" class="nav-item nav-link">班级课程信息管理</a>
                <a href="student?action=list" class="nav-item nav-link">学生信息管理</a>
                <a href="leave?action=listAudit" class="nav-item nav-link">审核请假单</a>
                <a href="leave?action=listExport" class="nav-item nav-link active">导出请假名单</a>
            </div>
        </nav>
    </div>
    <div class="content">
        <nav class="navbar navbar-expand bg-light navbar-light px-4 py-0" style="height: 48px;">

            <form action="leave" method="get">
                    <div class="d-none d-md-flex ms-4">
                        <input style="margin-top: 36px;width: 330px;background-color: #f0f0f0;" class="form-control border-0" type="text" name="classID" id="classID" placeholder="请输入班级查询">
<%--                        <button type="submit" class="btn btn-outline-primary" style="width: 80px;margin-top: 35px !important;">查询</button>--%>
<%--                        <input type="hidden" name="action" value="seek">--%>
                        <input style="margin-top: 36px;width: 330px;background-color: #f0f0f0;margin-left: 10px;" class="form-control border-0" type="text" name="term" id="term" placeholder="请输入学期查询">
                        <button type="submit" class="btn btn-outline-primary" style="width: 80px;margin-top: 35px !important;margin-left: 5px;">查询</button>
                        <input type="hidden" name="action" value="seekExport">
                </div>
            </form>
            <form action="leave" method="get">
                <button type="submit" class="btn btn-outline-primary" style="width: 99px;margin-top: 35px !important;margin-left: 10px;">查看全部</button>
                <input type="hidden" name="action" value="listExport">
            </form>
            <button type="button" class="btn btn-outline-success" onclick="window.location.href='leave?action=export'" style="width: 77px;margin-top: 19px;margin-left: 10px;">导出</button>
            <div class="navbar-nav align-items-center ms-auto" style="">
                <div class="nav-item dropdown">
                    <a href="login.jsp" class="btn btn-outline-danger" style="margin-top: 17px; width: 65px; margin-left: 70px; display: inline-block;">退出</a>
<%--                    <input type="hidden" name="action" value="src/main/webapp/login.jsp">--%>
                </div>
            </div>
        </nav>
        <div class="shadow-sm p-3 mb-5 bg-white rounded">
        <div class="container-fluid pt-4 px-4" style="background-color: #efefef;">
            <div class="bg-light text-center rounded p-4" style="height: 630px !important;">

                <form>
                    <%--                    <div class="table-responsive">--%>
                    <table class="table text-start align-middle table-bordered table-hover mb-0" >
                        <thead>
                        <tr>
                            <th scope="col"><input  type="checkbox"></th>
                            <th scope="col">请假编号</th>
                            <th scope="col">课程编号</th>
                            <th scope="col">请假事由</th>
                            <th scope="col">天数</th>
                            <th scope="col">学号</th>
                            <th scope="col" style="width: 20px;!important;">请假时间</th>
                            <th scope="col">状态</th>
                            <th scope="col">审核时间</th>
                            <th scope="col">审核意见</th>
<%--                            <th scope="col">操作</th>--%>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list}" var="leave_list">
                            <tr>
                                <td><input  type="checkbox"></td>
                                <td>${leave_list.leaveID}</td>
                                <td>${leave_list.courseID}</td>
                                <td>${leave_list.reason}</td>
                                <td>${leave_list.dayNum}</td>
                                <td>${leave_list.stuNo}</td>
                                <td>${leave_list.applyTime}</td>
                                <td style="color: <c:choose>
                                <c:when test="${leave_list.status == 1}">green</c:when>
                                <c:when test="${leave_list.status == 2}">red</c:when>
                                <c:otherwise>black</c:otherwise>
                                </c:choose>;">
                                    <c:choose>
                                        <c:when test="${leave_list.status == 1}">
                                            同意
                                        </c:when>
                                        <c:when test="${leave_list.status == 2}">
                                            不同意
                                        </c:when>
                                        <c:otherwise>
                                            待审核
                                        </c:otherwise>
                                    </c:choose>
                                </td>
                                <td>${leave_list.auditTime}</td>
                                <td>${leave_list.opinion}</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </form>
            </div>
        </div>
        </div>
    </div>
</div>
<div id="messageBox"></div>
<script src="../../../js/main.js" type="4bebc94b2db97a1f9680a39f-text/javascript"></script>

</body>
</html>
